Ext.ns('ru.proburo.oms.components.grid');

/**
 * @class ru.proburo.oms.components.grid.AbstractList
 * @extends Ext.grid.GridPanel
 */
ru.proburo.oms.components.grid.AbstractList = Ext.extend(Ext.grid.GridPanel, {
	
	constructor: function(config)
	{
        config = config || {};
        
        this.sm = config.sm ? config.sm : new Ext.grid.RowSelectionModel();
        
        Ext.applyIf(config, {
            
            loadMask: 	false,
            stripeRows: true,
            
            //view: 	  new Ext.ux.grid.BufferView({forceFit: true}),            
            viewConfig: {forceFit: true},
			tbar:     this.initTBar(),			
            bbar:     this.initBBar(),
            colModel: new Ext.grid.ColumnModel({
                defaults:
                {
                    width: 	  20,
                    sortable: true
                },
                columns: this.initColumns()
            })
            
        });
		
		this.store.setBaseParam('limit', this.pageSize);
        
        ru.proburo.oms.components.grid.AbstractList.superclass.constructor.call(this, config);
    },
	
	initTBar: function()
	{
		return [{text: 'add'}];
	},
	
	initBBar: function()
	{
		return new Ext.PagingToolbar({
			store: 		 this.store,
			pageSize: 	 50,
			displayInfo: true,
			displayMsg:  '{0} - {1} из {2}',
			emptyMsg: 	 "Нет элементов для отображения"
		});
	},
	
	initColumns: function()
	{
        throw new Error('Abstract method called.');
	},
	
	pageSize: 50
});